package com.hmall.user.web;

import com.hmall.user.pojo.Address;
import com.hmall.user.servicr.UserService;
import com.hmall.user.utils.ThreadLocalUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 29143
 */
@RestController
public class UserWeb {

    @Autowired
    private UserService userService;

    /**
     * 根据用户id查询地址列表
     * @return
     */
    @GetMapping("/address/uid")
    public List<Address> getAddressList(){
        return userService.findAddressListById();
    }


    /**
     * 根据addressId查询地址信息
     * @param addressId
     * @return
     */
    @GetMapping("/address/{addressId}")
    public Address getAddress(@PathVariable("addressId") Long addressId){
        return userService.findAddressById(addressId);
    }





}
